﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CPPEI.Coolzon.Core;
using CPPEI.Coolzon.Core.Data;
using CPPEI.Coolzon.Core.Repositories;

namespace CPPEI.Coolzon.ManagementCenter
{
    public partial class Test : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            using (DbContext context = new DbContext())
            {
                IUserRepository userRepository = RepositoryFactory.Create<IUserRepository>();

                PagedList<CPPEI.Coolzon.Core.Data.User> userList = userRepository.GetUserList(context, 0, 25);


                IPrivilegeRepository privilege = RepositoryFactory.Create<IPrivilegeRepository>();
                Privilege p = new Privilege();
                p.Id = Guid.NewGuid();
                p.Name = "priName";
                p.Code = "123";
                p.Type = "312";
                privilege.CreatePrivilege(context, p);
                p.Name = "111111";
                privilege.UpdatePrivilege(context, p);
                privilege.RemovePrivilege(context, p);

                IUserPrivilegeRepository upr = RepositoryFactory.Create<IUserPrivilegeRepository>();
                UserPrivilege up = new UserPrivilege();
                up.Id = Guid.NewGuid();
                up.UserId = Guid.NewGuid();
                up.PrivilegeId = Guid.NewGuid();
                upr.CreateUserPrivilege(context, up);
                up.PrivilegeId = Guid.NewGuid();
                upr.UpdateUserPrivilege(context, up);
                upr.RemoveUserPrivilege(context, up);


            }
        }
    }
}